<!DOCTYPE html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="frames"></div>
<script type="text/javascript">
function handleEvent(event) {
  testPassed("Event is correctly dispatched");
}

var frame1 = document.createElement("iframe");
document.getElementById("frames").appendChild(frame1);
frame1.contentDocument.body.addEventListener("click", handleEvent);

var frame2 = document.createElement("iframe");
document.getElementById("frames").appendChild(frame2);
frame2.contentDocument.body.addEventListener("click", handleEvent);

document.getElementById("frames").removeChild(frame1);

frame2.contentDocument.body.click();
</script>
</body>
</html>
